package com.fr.base.core.antlr;

import java.io.IOException;

class TreeWalkerGrammar extends Grammar
{
  protected boolean transform = false;

  TreeWalkerGrammar(String paramString1, Tool paramTool, String paramString2)
  {
    super(paramString1, paramTool, paramString2);
  }

  public void generate()
    throws IOException
  {
    this.generator.gen(this);
  }

  protected String getSuperClass()
  {
    return "TreeParser";
  }

  public void processArguments(String[] paramArrayOfString)
  {
    for (int i = 0; i < paramArrayOfString.length; ++i)
      if (paramArrayOfString[i].equals("-trace"))
      {
        this.traceRules = true;
        this.antlrTool.setArgOK(i);
      }
      else if (paramArrayOfString[i].equals("-traceTreeParser"))
      {
        this.traceRules = true;
        this.antlrTool.setArgOK(i);
      }
  }

  public boolean setOption(String paramString, Token paramToken)
  {
    if (paramString.equals("buildAST"))
    {
      if (paramToken.getText().equals("true"))
        this.buildAST = true;
      else if (paramToken.getText().equals("false"))
        this.buildAST = false;
      else
        this.antlrTool.error("buildAST option must be true or false", getFilename(), paramToken.getLine(), paramToken.getColumn());
      return true;
    }
    if (paramString.equals("ASTLabelType"))
    {
      super.setOption(paramString, paramToken);
      return true;
    }
    if (paramString.equals("className"))
    {
      super.setOption(paramString, paramToken);
      return true;
    }
    if (super.setOption(paramString, paramToken))
      return true;
    this.antlrTool.error("Invalid option: " + paramString, getFilename(), paramToken.getLine(), paramToken.getColumn());
    return false;
  }
}